import jsonschema

schema = {"type": "object",
          "properties": {
              "desc": {"type": "string"},
              "req_body":
                  {"type": "object",
                   "properties": {
                       "departmentName": {"type": "string"},
                       "formOfEmployment": {"type": "integer"},
                       "mobile": {"pattern": "^[0‐9]{11}$"},
                       "timeOfEntry": {"type": "string"},
                       "username": {"const": "王贤"},
                       "workNumber": {"const": 9527}
                   },
                   "required": ["username", "mobile", "workNumber"]
                   },
              "status_code": {"const": 200},
              "success": {"type": "boolean"},
              "code": {"const": 10000},
              "message": {"pattern": "成功$"}
          },
          "required": ["desc", "req_body"]
          }

data = {"desc": "添加成功(组合参数)",
        "req_body": {
            "departmentName": "测试1部",
            "formOfEmployment": 1,
            "mobile": 1380000001,
            "timeOfEntry": "2022-09-06T16:00:00.000Z",
            "username": "王贤",
            "workNumber": 9527
        },
        "status_code": 200,
        "success": True,
        "code": 10000,
        "message": "操作成功"}

print(jsonschema.validate(instance=data, schema=schema))
